package xyz.robinbingo.turing.dubbo.consumer;

import xyz.robinbingo.turing.dubbo.common.proxy.ProxyFactory;
import xyz.robinbingo.turing.dubbo.provider.UserFacade;

/**
 * Starter
 *
 * @author Robin
 * @date 2021/1/29 下午3:53
 **/
public class ConsumerStarter {
    public static void main(String[] args) {
        // ---------- 1.0 最原始版本 ----------
        // 构建invocation
//        Invocation invocation = Invocation.builder()
//                .interfaceName(UserFacade.class.getName())
//                .methodName("hello")
//                .paramTypes(new Class[]{String.class})
//                .params(new Object[]{"Robin"})
//                .build();
//        // 发送请求
//        Object string = new CustomHttpClient().send("localhost", 8080, invocation);
//        System.out.println("success! " + string);

        // ---------- 2.0 引入代理来处理请求 ----------
        UserFacade facade = ProxyFactory.getProxy(UserFacade.class);
        String string = facade.hello("Robin");
        System.out.println("success! " + string);
    }


}
